from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options

# 指定ChromeDriver的路径
service = Service(executable_path='D:\Program Files\Python\drives\chromedriver.exe')
#service = Service(executable_path='C:\Program Files\Google\Chrome\Application')

# 创建ChromeOptions对象
options = Options()
# 禁用GPU加速
options.add_argument('--disable-gpu')
# 指定Chrome浏览器的路径
#options.binary_location = 'D:\WorkSoftware\chrome-win64\chrome.exe'
options.binary_location = 'C:\Program Files\Google\Chrome\Application\chrome.exe'

# 创建WebDriver对象
driver = webdriver.Chrome(service=service, options=options)

# 打开百度页面
driver.get('http://127.0.0.1:8090/dist/#/login?flag=1&userId=admin')

# 输出页面标题
print(driver.title)
time.sleep(2)
# 关闭浏览器
print("Quitting Chrome...")
driver.quit()
print("Chrome quit successfully.")